next_power_of_two Function

public pure elemental function next_power_of_two(n) result(rst)

Provides the next higher integer power of two.

Arguments

Type IntentOptional Attributes Name
integer(kind=int32), intent(in) :: n

The value to test.

Return Value integer(kind=int32)

The next power of two higher than n. If n is already a power of two, its value is simply returned. For instance, if n is set to 128, then a value of 7 is returned ( ).